package com.example.simple.simple

import android.os.Bundle
import android.os.PersistableBundle
import android.view.View
import android.widget.Toast
import com.example.simple.R
import com.orhanobut.logger.Logger
//Kotlin 替代BufferKnife的插件
import kotlinx.android.synthetic.main.activity_login.*
import com.xxf.basemvp.weakbase.weak.WeakActivity
class LoginActivity : WeakActivity<LoginContract.View, LoginPresenter>() {

    override fun createPresenter(): LoginPresenter {
        return LoginPresenter(mView)
    }

    override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
        super.onCreate(savedInstanceState, persistentState)
        setContentView(R.layout.activity_login)
        txt.setText("nihao ")
    }
    override fun getLayoutResId(): Int {

        return R.layout.activity_login
    }

    override fun initView() {
        findViewById<View>(R.id.txt).setOnClickListener {
            mPresenter?.doLogin()
        }
    }


    var mView: LoginContract.View = object : LoginContract.View {
        override fun loginSuc() {
            Logger.d("loginSuc")
            Toast.makeText(this@LoginActivity, "loginSuc", Toast.LENGTH_LONG).show()

        }

        override fun loginFail(error: Int) {
            Logger.d("loginFail")
            Toast.makeText(this@LoginActivity, "loginFail", Toast.LENGTH_LONG).show()
        }

    }

}
